﻿<Window x:Class="Bugger.Presentation.Views.SettingDialogWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:p="clr-namespace:Bugger.Presentation.Properties"
        xmlns:dd="clr-namespace:Bugger.Presentation.DesignData"
        xmlns:c="clr-namespace:Bugger.Presentation.Converters"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        mc:Ignorable="d" d:DataContext="{d:DesignInstance dd:SampleSettingDialogViewModel, IsDesignTimeCreatable=True}"
        Title="{Binding Title}" Height="480" Width="550" ResizeMode="NoResize"
        Icon="{Binding Mode=OneWay, Source={StaticResource BuggerImageSource}}"
        ShowInTaskbar="False" WindowStartupLocation="CenterScreen" Closing="Window_Closing" Topmost="True">
    <Grid Margin="10">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="100" />
            <ColumnDefinition Width="100" />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="5" />
            <RowDefinition Height="30" />
        </Grid.RowDefinitions>
        <TabControl Grid.ColumnSpan="3" ItemsSource="{Binding Views}" SelectedItem="{Binding SelectView}"
                    Margin="0,0,0,10">
            <TabControl.RenderTransform>
                <TranslateTransform />
            </TabControl.RenderTransform>

            <TabControl.ItemContainerStyle>
                <Style TargetType="TabItem" BasedOn="{StaticResource {x:Type TabItem}}">
                    <Setter Property="Header" Value="{Binding Title}" />
                </Style>
            </TabControl.ItemContainerStyle>
            <TabControl.Template>
                <ControlTemplate TargetType="TabControl">
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="AUTO"/>
                            <RowDefinition Height="*"/>
                        </Grid.RowDefinitions>
                        <TabPanel x:Name="HeaderPanel" Panel.ZIndex ="1" KeyboardNavigation.TabIndex="1" IsItemsHost="true"/>
                        <ScrollViewer HorizontalScrollBarVisibility="Disabled" Grid.Row="1" VerticalScrollBarVisibility="Auto" CanContentScroll="True">
                            <ContentPresenter x:Name="PART_SelectedContentHost" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Margin="{TemplateBinding Padding}" ContentSource="SelectedContent"/>
                        </ScrollViewer>
                    </Grid>
                </ControlTemplate>
            </TabControl.Template>
        </TabControl>
        <ProgressBar Grid.Row="1" Grid.ColumnSpan="3" Value="100" Foreground="{Binding SettingDialogStatus, Converter={x:Static c:SettingDialogStatusToColorConverter.Default}}"
                             Background="{x:Null}" BorderBrush="{x:Null}" IsIndeterminate="{Binding SettingDialogStatus, Converter={x:Static c:SettingDialogStatusToIndeterminateConverter.Default}}"
                             Visibility="{Binding SettingDialogStatus, Converter={x:Static c:SettingDialogStatusToVisibilityConverter.Default}}"/>
        <TextBlock Grid.Row="2" Grid.ColumnSpan="1" Text="{Binding SettingDialogStatus, Converter={x:Static c:SettingDialogStatusToMessageConverter.Default}}" Margin="0" 
                             Visibility="{Binding SettingDialogStatus, Converter={x:Static c:SettingDialogStatusToVisibilityConverter.Default}}" VerticalAlignment="Center"/>
        <Button Content="{x:Static p:Resources.SettingSubmit}" Grid.Column="1" HorizontalAlignment="Right" Margin="0"
                Grid.Row="2" VerticalAlignment="Bottom" Width="75" Height="25"
                Command="{Binding SubmitCommand, Mode=OneWay}" />
        <Button Content="{x:Static p:Resources.SettingCancel}" Grid.Column="2" HorizontalAlignment="Right" Margin="0"
                Grid.Row="2" VerticalAlignment="Bottom" Width="75" IsCancel="True" Height="25"
                Command="{Binding CancelCommand, Mode=OneWay}" />
    </Grid>
</Window>
